package Web;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

    public class MainServlet extends HttpServlet {
        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        	response.setContentType("text/html");
            response.setStatus(HttpServletResponse.SC_OK);
            response.getWriter().println("<html><head>");
            response.getWriter().println("<center><u><b> The Tag World <br><hr></u></b><br>");
            response.getWriter().println("<i>Hello and thank you for using this system!<br>");
            response.getWriter().println("  <script language=Javascript>");
            response.getWriter().println("    function printTime(time) {");
            response.getWriter().println("       document.getElementById('text').innerHTML = time;");
            response.getWriter().println("    }");
            response.getWriter().println("    function printListener(listener) {");
            response.getWriter().println("       document.getElementById('text2').innerHTML = listener;");
            response.getWriter().println("    }");
            response.getWriter().println("    function printInit(init) {");
            response.getWriter().println("       document.getElementById('text3').innerHTML = init;");
            response.getWriter().println("    }");
            response.getWriter().println("    function printTag(tag) {");
            response.getWriter().println("       document.getElementById('text4').innerHTML = tag;");
            response.getWriter().println("    }");
            
            response.getWriter().println("function testResults (form) {");
         	response.getWriter().println("    var TestVar = form.inputbox.value;");
         	
         	response.getWriter().println("alert ('You typed: ' + TestVar);");
         	response.getWriter().println("}");

            response.getWriter().println("  </script>");
            response.getWriter().println("</head> ");
            response.getWriter().println("<body>");
            
            response.getWriter().println("<FORM NAME='myform' ACTION='' METHOD='GET'>Enter something in the box: <BR>");
            response.getWriter().println("<INPUT TYPE='text' NAME='inputbox' VALUE=''><P>");
            response.getWriter().println("<INPUT TYPE='button' NAME='button' Value='Click' onClick='testResults(this.form)'>");
            response.getWriter().println("</FORM>");
            
            response.getWriter().println("  <iframe id=iframe name=iframe width =0 height =0 border=0>");
            response.getWriter().println("  </iframe>");     
            response.getWriter().println("  <a href =time target=iframe>start timer</a>"); 
            response.getWriter().println("  <a href =time1 target=iframe>stop timer</a>");
            response.getWriter().println("  <p id=text>0</p>");
            response.getWriter().println("  <br>");
            response.getWriter().println("  <a href =start_listener target=iframe>start listener</a>");
            response.getWriter().println("  <br><br>");
            response.getWriter().println("  <a href =end_listener target=iframe>stop listener</a>");
            response.getWriter().println("  <p id=text2> </p>");
            response.getWriter().println("  <br>");
            response.getWriter().println("  <a href =start_init target=iframe>start init</a>");
            response.getWriter().println("  <br><br>");
            response.getWriter().println("  <a href =stop_init target=iframe>stop init</a>");
            response.getWriter().println("  <br><br>");
            response.getWriter().println("  <a href =pause_init target=iframe>pause init</a>");
            response.getWriter().println("  </center><p id=text3> </p><center>");
           
        
            response.getWriter().println("  <p id=text4> </p>");
            response.getWriter().println("  <br> <img src=http://www.bazz.co.il/fs_images/a_big_717_2195.jpg> <br>");
            response.getWriter().println("</body></html>");
         } 
}